// SyncApi 组件内容
<template>
  <div v-for="(people, index) in peoples.results" :key="index">
    {{ people.name }} {{ people.birth_year }}
  </div>
</template>

<script setup>
import { ref } from 'vue'
const peoples = ref({
  results: []
})
const getData = function () {
  // return new Promise((resolve) => {
  //   setTimeout(() => {
  //     resolve([
  //       { name: 'Luke Skywalker', birth_year: '19BBY' },
  //       { name: 'C-3PO', birth_year: '112BBY' },
  //       { name: 'R2-D2', birth_year: '33BBY' }
  //     ])
  //   }, 3000)
  // })
  return new Promise((resolve) => {
    setTimeout(() => {
      resolve([
        { name: 'dfgsg', birth_year: 1999 },
        { name: 'fssgsd', birth_year: 1234 },
        { name: 'dgbsfd', birth_year: 4532 }
      ])
    },5000)
  })
}
peoples.value.results = await getData()
</script>
